/************    将路由抽取成一个模块    ************/
/** 1. 导入路由 **/
import VueRouter from 'vue-router'

/** 2. 导入自定义路由的组件 **/
import HomeContainer from "./components/tabbars/HomeContainer.vue";
import MemberContainer from "./components/tabbars/MemberContainer.vue";
import ShopCarContainer from "./components/tabbars/ShopCarContainer.vue";
import SearchContainer from "./components/tabbars/SearchContainer.vue";
import NewsList from "./components/news/NewsList.vue";
import NewInfo from "./components/news/NewInfo.vue";
import PhotoList from "./components/photos/PhotoList.vue";
import PhotoInfo from "./components/photos/PhotoInfo.vue";
import GoodsList from "./components/goods/GoodsList.vue";
import GoodsInfo from "./components/goods/GoodsInfo.vue";
import GoodsDesc from "./components/goods/GoodsDesc.vue";
import GoodsComment from "./components/goods/GoodsComment.vue";

/** 3. 创建路由对象 **/
const router = new VueRouter({
    routes: [
        { path : '/', redirect : './home' }, // 重定向到首页路由
        { path : '/home', component : HomeContainer }, // 首页路由
        { path : '/member', component : MemberContainer }, // 会员路由
        { path : '/shopCar', component : ShopCarContainer }, // 购物车路由
        { path : '/search', component : SearchContainer }, // 搜索路由
        { path : '/home/newsList', component : NewsList }, // 新闻列表路由
        { path : '/home/newInfo/:id', component : NewInfo, props : true }, // 新闻信息路由, 设置路由传值
        { path : '/home/photoList', component : PhotoList }, // 图片分享列表路由
        { path : '/home/photoInfo/:id', component : PhotoInfo, props: true }, // 图片信息路由, 设置路由传值
        { path : '/home/goodsList', component : GoodsList }, // 商品购买的路由
        { path : '/home/goodsInfo/:id', component : GoodsInfo, props: true }, // 商品详情页路由, 设置路由传值
        { path : '/home/goodsDesc/:id', component : GoodsDesc, props: true }, // 商品图文介绍路由, 设置路由传值
        { path : '/home/goodsComment/:id', component : GoodsComment, props: true }, // 商品评论路由, 设置路由传值
    ],
    linkActiveClass: 'mui-active' // 手动设置路由被激活时使用的class样式, 显示高亮样式
})

/** 4. 将自定义的路由对象暴露出去 **/
export default router